function prev_search_item(){var all_items_count=$(".header-search .inside a").length- 1;var current_item=$(".header-search .inside a.hover").index()!=-1?$(".header-search .inside a.hover").index():0;if(current_item>0){$(".header-search .inside a.hover").removeClass('hover');$(".header-search .inside a").eq(current_item- 1).addClass('hover');}else{$(".header-search .inside a.hover").removeClass('hover');$(".header-search .inside a").eq(all_items_count).addClass('hover');}}
function next_search_item(){var all_items_count=$(".header-search .inside a").length- 1;var current_item=$(".header-search .inside a.hover").index();if(current_item<all_items_count){$(".header-search .inside a.hover").removeClass('hover');$(".header-search .inside a").eq(current_item+ 1).addClass('hover');}else{$(".header-search .inside a.hover").removeClass('hover');$(".header-search .inside a").eq(0).addClass('hover');}}
$(function(){'use strict';$("html").click(function(){$('.header-search .inside').empty();$('.header-search').removeClass('open');});$("input[name=q]").keydown(function(e){if(e.keyCode==13){var current_item=$(".header-search .inside a.hover");if(current_item.length){var item_url=current_item.prop('href');window.location.href=item_url;e.preventDefault();return false;}}});$("input[name=q]").keyup(function(e){if($(this).val().length<2||$(this).val().length>=80){$('.header-search .inside').empty();$('.header-search').removeClass('open');return false;}
if(e.keyCode==38){prev_search_item();}else if(e.keyCode==40){next_search_item();}else if(e.keyCode==13){var current_item=$('.header-search .inside a.hover');if(current_item.length){var item_url=current_item.prop('href');window.location.href=item_url;e.preventDefault();return false;}}else{$('.header-search .inside').empty();$.get('/loader.php?query='+ $(this).val(),function(data){if(data){$('.header-search .inside').empty();$('.header-search').addClass('open');$.each(data,function(){var price=(this.skoro==1)?'СКОРО':(((this.random==1)?'от ':'')+ this.price+' <i class="fa-'+ this.curr+'"></i>');$('.header-search .inside').append('<a class="item" href="'+(this.random==1?'/':'/game/')+(this.random==1?'random/':this.link)+'"><span class="info"><span class="price">'+ price+'</span><span class="text">'+ this.name+'</span></span><span class="image"><img width="100" src="'+ this.img+'" alt="" /></span></a>');});}},'json');}});});$(document).ready(function(){$("#tabs").tabs();$("#slider-place .slider").slider({value:100,min:50,max:1000,step:50,slide:function(event,ui){$(".price-slide .href span").text(ui.value);$(".price-slide .href").attr('href','/price/'+ ui.value);}});$("#dd").click(function(){$(".wrapper-dropdown-1").toggleClass('active');});$(document).on('click','.bottom form button',function(){var email=$('.bottom form input').val();if(email.length){$.post('/ajax/get_discount.php',{email:email},function(data){if(data.error==0){$(".bottom ul").html(data.html).fadeIn();}},'json');}
return false;});$(document).ready(function(){$(document).on('click','.head form button',function(){$('.head form .promocode').val('B303229A180F424E');return false;});});$('.bottom-news-slider .slider-place .slider').anythingSlider({expand:true,hashTags:false,autoPlay:false,buildNavigation:false,buildArrows:true,buildStartStop:false,toggleArrows:false,delay:3000,animationTime:2000,showMultiple:3,changeBy:1,forwardText:"",backText:""});$("#list_special_offer>ul>li").mouseenter(function(){$(this).find("span.name").animate({"bottom":"0px"},"fast");}).mouseleave(function(){$(this).find("span.name").animate({"bottom":"-32px"},"fast");});function nowbuy(){$.get('/get_now_buy.php',function(data){if(data.error==0){if($('#NowBuy').children(0).attr('data-id')!=data.id){$('#NowBuy').html(data.html).hide(0).fadeIn("fast");}}},'json');}
setInterval(nowbuy,20000);(function(a){a.fn.countdown=function(h,e,f){var c=a(this);var k=new Date();var g=h- Math.floor(k.getTime()/ 1000);
c.attr("title",f);function i(){var l=new Date();var m=Math.floor(e-(l.getTime()/ 1000) - g);
m--;if(m<=0){clearInterval(b);c.html("00 : 00 : 00");return false}
c.html(d(m))}
function d(n){var m=0;var o=0;var l=0;m=Math.floor(n/3600);o=Math.floor((n- m*3600)/ 60);
l=n- m*3600- o*60;return(m<10?"0"+ m:m)+" : "+(o<10?"0"+ o:o)+" : "+(l<10?"0"+ l:l)}
i();var b=setInterval(i,1000)}})(jQuery);(function($){var win=null;$.fn.vkAction=function(options,callback){options=$.extend({url:window.location.href},options);return this.click(function(e){if(win){e.preventDefault();return;}
var width=550,height=350,top=(window.screen.height- height)/ 2,
left=(window.screen.width- width)/ 2;
var config=['scrollbars=yes','resizable=yes','toolbar=no','location=yes','width='+ width,'height='+ height,'left='+ left,'top='+ top].join(',');win=window.open('http://vkontakte.ru/share.php?'+ $.param(options),'TweetWindow',config);(function checkWindow(){try{if(!win||win.closed){throw"Closed!";}else{setTimeout(checkWindow,100);}}catch(e){win=null;callback();}})();e.preventDefault();});};})(jQuery);});